package com.xf.pub.exception;

import com.xf.pub.exception.base.BaseException;
import org.apache.commons.logging.Log;

public class ServiceException extends BaseException
{
  public String errorStatus;

  public ServiceException()
  {
  }

  public ServiceException(String message)
  {
    super(message);
  }

  public ServiceException(String message, long errorCode) {
    super(message);
    super.setErrorCode(errorCode);
    setErrorStatus(errorCode + "");
    this.logger.error("service exception, errorCode: " + errorCode + "\nMessage:" + message);

    this.logger.error("--------------------end exception log----------------------------------------");
  }

  public ServiceException(String message, String errorStatus) {
    super(message);
    super.setErrorCode(this.errorCode);
    setErrorStatus(errorStatus + "");

    this.logger.error("service exception, errorCode: " + this.errorCode + "\nMessage:" + message);

    this.logger.error("--------------------end exception log----------------------------------------");
  }

  public ServiceException(long errorCode)
  {
    super(errorCode);
    super.setErrorCode(errorCode);
    setErrorStatus(errorCode + "");
    this.logger.error("service exception, errorCode: " + errorCode);
    this.logger.error("--------------------end exception log----------------------------------------");
  }

  public long getErrorCode() {
    return super.getErrorCode();
  }

  public String getMessageAndErrorCode() {
    return super.getMessageAndErrorCode();
  }

  public void setErrorCode(long errorCode) {
    super.setErrorCode(errorCode);
  }

  public String getErrorStatus() {
    return this.errorStatus;
  }

  public void setErrorStatus(String errorStatus) {
    this.errorStatus = errorStatus;
  }
}